package com.xiaoxu.controller;

import com.xiaoxu.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

//Operation 接口 加注释
@Api(tags="hello 控制类")
@RestController
public class HelloController {
    @GetMapping("hello")
    public String hello() {
        return "hello";
    }

    //只要我们的接口中返回值存在实体类 他就会被扫描到swagger
    @PostMapping(value = "/user")
    public User user(){
        return new User();
    }

    @ApiOperation("hello2方法")
    @GetMapping("/hello2")
    public String hello2(@ApiParam("用户名") String username){
        return "hello"+username;
    }

    @ApiOperation("Post测试类")
    @PostMapping("/postt")
    @ResponseBody
    public User postt(@ApiParam("用户名")  User user){
        return user;
    }
}
